home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 0022-3.564 / dmg-0139 / news.txt / letters.asc < prev    next >
Text File  |  1997-04-16  |  5KB  |  133 lines

  1.  
  2.                                  LETTERS
  3.                                  =======
  4.  
  5. Hi Dave,
  6.          How the time flies......it seems like only yesterday that  summer 
  7. was just about to start and STen 4 was the latest thing on the market  and 
  8. now the evenings are drawing in and......but enough of this rubbish.  Have 
  9. enclosed  three discs for later versions.  Do not wish to go over the  top 
  10. but  I look forward to future editions!  Have stuck in a couple  of  extra 
  11. stamps.
  12.  
  13.                                    Regards,
  14.  
  15.                                         John Corbett
  16.  
  17.  
  18.                                 ~~~OOOO~~~
  19.  
  20.  
  21. Dear Dave,
  22.           Thank  you for speedily sending me your disk magazine.  I  think 
  23. its excellent, keep up the good work!
  24.  
  25. I'm writing to you because I want to obtain back issue's of your magazine. 
  26. I don't know how many there are but if you can send me information on  how 
  27. many disks to send + postage fee I would be grateful!
  28.  
  29.                                    Yours,
  30.  
  31.                                         Lee Hughes
  32.  
  33. Lee,
  34.     we now are on the eighth issue of STEN,  numbered 0 -7.  I'm presently 
  35. reworking the old issues to take advantage of the new shell.  They are all 
  36. available from myself, John, Mick or Dave Cowling. All you need to send is 
  37. the correct number of discs and a stamped-self-addressed-envelope.
  38.  
  39.                                         Dave
  40.  
  41.  
  42.                                 ~~~OOOO~~~
  43.  
  44.  
  45. Dear Dave,
  46.          I hope you can help me.  In a recent copy of ST FORMAT, Oct 1991, 
  47. there  was a technical article on GFA programming.  The author  gave  some 
  48. examples of disc input and output. I have tried to use the routine to load 
  49. a file of any size into memory with some success.  It works sometimes  and 
  50. not  others,  what am I doing wrong?  I have included the program with  my 
  51. disk for the next issue of STEN.
  52.  
  53.                                    Yours sincerely,
  54.  
  55.                                         Tom Nicholson
  56.  
  57. Tom,
  58.     the program that you sent (see below) is one that I have seen often. I 
  59. don't  know if this is a genuine problem area or one that the  author  has 
  60. simply  copied from another source and not bothered to check if it  really 
  61. works.
  62.  
  63. The problem is in reading files into memory for future  manipulation.  The 
  64. article  in  question  opens  the file and  determines  its  length  using 
  65. LOF(#1),  nothing wrong so far.  It then creates a string of the  required 
  66. length, into which, to load the program. 
  67.  
  68. This is where the routine falls apart.  In GFA BASIC it is not possible to 
  69. have a string longer than 32767 bytes.  So,  if the file you are trying to 
  70. load is larger than this your program will crash.
  71.  
  72. The ST Format routine:
  73. ----------------------
  74.  
  75. To load an unknown sized block off(sic) data into A$, you would use:
  76.  
  77. OPEN "I", #1, "A:TEST2.DAT"        !Open the file
  78. L=LOF(#1)                          !How many bytes long is it?
  79. CLOSE #1                           !Close the file
  80. A$=SPACE$(L)                       !Create empty string L bytes long
  81. BLOAD "filename",Varptr(A$),L      !Zap it into memory
  82.  
  83. Which  is a load of bollocks,  it will only work for files of length  less 
  84. than 32768 bytes.
  85.  
  86.                                   ------
  87.  
  88. The answer is to dimension an interger array,  which can be any size. This 
  89. is  done  by dimensioning an integer array using the length  of  the  file 
  90. previously  found,  you have to divide the length by 4 as an integer is  4 
  91. bytes long.
  92.  
  93. The ammended routine will now read in any size of file if there is  enough 
  94. memory available.
  95.  
  96. The amended routine:
  97. ---------------------
  98.  
  99. To really load an unknown sized block of data into a variable,  you'd use:
  100.  
  101. OPEN "I", #1, "filename"           !Open the file
  102. L=LOF(#1)                          !How many bytes long is it?
  103. CLOSE #1                           !Close the file
  104. ERASE  A%()                        !This  lets you use the  routine  more 
  105.                                    !than once
  106. DIM A%(L/4)                        !Create space in memory for file
  107. BLOAD "filename",VARPTR(A%(0)),L   !Load it into memory
  108.  
  109. Which works for files of any size.
  110.  
  111.                                 ~~~OOOO~~~
  112.  
  113.  
  114. Dear Dave,
  115.          I  really  liked the last issue of STEN.  In the  article  on  ST 
  116. variables  the  author said that if anyone was interested he  would  write 
  117. further articles.
  118.  
  119. I'm  interested,  would you let him know as I would like to find out  more 
  120. about the subject.
  121.  
  122.                                    Best wishes,
  123.                          
  124.                                         Jack Warburton
  125.  
  126. Jack, 
  127.      I'm  afraid that article came from the public domain and  I  wouldn't 
  128. have a clue as how to contact the author. If he's reading this, please get 
  129. in touch as I'm sure quite a few people would like to know more.
  130.  
  131.                                 ~~~OOOO~~~
  132.  
  133.